import groovy.json.JsonBuilder
import groovy.json.JsonOutput
import groovy.json.JsonSlurper

class HelloWorld {
    static void main(args) {
        println "Hello World"

        def json = new JsonBuilder()
        json.state {
            name "fulei.yang"
            age "18"
        }
        println(JsonOutput.prettyPrint(json.toString()))

        def slurper = new JsonSlurper()
//      def result = slurper.parseText(json.toString())
        def result = slurper.parseText(JsonOutput.prettyPrint(json.toString()))
        def age=result.state.age
        println(result.toString())
        println(age.toString())

//        def strs=[1,2,3] as String[]
        def strs="YYYYY" as String[]
        strs+=4
        println strs

        def list=[]
        list.add(15)
        list+=16
        println list
    }
}